1. Field of the Invention
The present invention relates to devices for recording count data in a memory area configured by such as a memory and methods of recording the count data, and in particular, to a count data recording device and a recording method capable of detecting a corruption occurred in the count data recorded in the memory area and correcting the corrupted count data that has been detected to restore normality.
2. Description of the Related Art
Conventionally, memories are used for recording and retaining data. In particular, a nonvolatile memory is typically used for a purpose of retaining data within the memory for an extended period of time. As used herein, the nonvolatile memory collectively means a memory that can retain stored information even when not powered.
However, the nonvolatile memory (for example, Electrically Erasable and Programmable Read Only Memory (EEPROM)) generally has poor write endurance. The write endurance of the nonvolatile memory varies depending on a type of the memory, but the number of rewrites is usually limited to on the order of 1,000,000 write cycles, for example.
The nonvolatile memory is used for recording a specific type of data in some cases. Examples of such a specific type of data include count data, which is used to record and count a number of times of some sort by incrementing a specific value by a predetermined value. If the predetermined value is negative, the count data expresses the number that is recorded as the specific value being sequentially decremented. The count data is used for, for example, recording a number of times that a specific device (such as a photoreceptor unit of an image processing device) has operated.
When recording such count data in a memory having relatively low write endurance, the count data is recorded in the memory in a following manner, and restored when the data is corrupted.
For example, when the count data is to be written for 3,000,000 times using a memory, a single address of which can be written to for 1,000,000 times, three addresses of the memory are used and pieces of the count data is written to the three addresses sequentially one by one. As the count data pieces are incremented (or decremented) by a predetermined value, three values that are incremented (or decremented) by the predetermined value to each other are respectively recorded to the three addresses.
As the count data pieces are naturally incremented (or decremented) by a predetermined value, even when one of the recorded count data pieces is corrupted, it is possible to restore the corrupted count data piece by obtaining a value by adding (or subtracting) either the predetermined value or a value twice as large as the predetermined value to a value of another count data piece that is not corrupted, and by writing the obtained value to an address of the corrupted count data piece.
As described above, by using a memory, a single address of which can be written for 1,000,000 times, the count data can be written and restored for 3,000,000 times using three addresses.
Further, there is an example in which 3,500,000 write cycles of the count data is realized using a memory, a single address of which can be written for 1,000,000 write cycles, in the following manner.
First, count data pieces are written to three addresses sequentially one by one, in the same manner as the previous example, up to a predetermined number of times (for example, 970,000 times). Subsequently, unlike the previous example, the count data pieces are written to different three addresses that are different from the previous three addresses sequentially one by one.
According to such a method, in order to realize 3,500,000 write cycles of the count data, total ten addresses are necessary including the six addresses to which the count data pieces are written, three addresses each retaining a number of times of writing to each of the three addresses, and a single address that retains data indicating which address group between a group of the three addresses and a group of the different three addresses is used to write the count data pieces.
Theoretically, only four addresses, to each of which data can be written for 1,000,000 times are sufficient for the recording of the count data pieces for 3,500,000 write cycles. Nevertheless, the count data pieces are recorded (and the corrupted count data piece is restored) using ten addresses according to the above conventional example. This is undesirable in terms of from an aspect of use efficiency of a memory.
Further, examples of the conventional technique for detecting an error in recorded data and restoring the error include techniques disclosed in patent documents described below.
JP 7-078232 A discloses a counter device for recording count data. The counter device according to JP 7-078232 A is provided with a control unit, and a plurality of sub-counters to which initial values that are a plurality of continuous values are set, respectively. When counting up, the control unit of the counter device determines whether a largest value and a second largest value among values retained in the plurality of sub-counters are continuous. If it is determined not to be continuous, the control unit rewrites the value of the sub-counter retaining a smallest value to a value obtained by adding two to a second largest value and sets the rewritten value as a counting value. Alternatively, if it is determined to be continuous, the control unit rewrites the value of the sub-counter retaining the smallest value to a value obtained by adding one to a largest value and sets the rewritten value as a counting value. As described above, focusing on continuity of values retained in the plurality of sub-counters, the counter device according to JP 7-078232 A determines whether or not the value retained in each sub-counter is proper and restores an error in the counting value using a value that is determined to be proper.
JP 2000-172133 A discloses a life time management device for image forming devices capable of storing information expressing a rate of usage of a replaceable unit mounted to an image forming device. The device according to JP 2000-172133 A is provided with a nonvolatile memory that stores the information expressing the rate of usage of the replaceable unit, a writing unit that writes the information expressing the rate of usage of the replaceable unit to the nonvolatile memory, and a restoration unit that detects and restores the erroneous information written to the nonvolatile memory. Further, the nonvolatile memory is provided with three or more areas each storing the information expressing the rate of usage of the replaceable unit. When writing the information expressing the rate of usage of the replaceable unit, the writing unit of the life time management device writes the information expressing the rate of usage of the replaceable unit of the same content to each of the three or more areas. Then, the restoration unit of the life time management device determines whether or not pieces of the information written respectively to the three or more areas are identical. When it is determined to be not identical, the restoration unit carries out a restoration process so that the pieces of information written respectively to the three or more areas are identical. As described above, focusing on the sameness of information written in the plurality of memory areas, the life time management device for image forming devices according to JP 2000-172133 A detects erroneous information and restores the erroneous information to restore proper information.
As described above, a number of techniques have been proposed for recording count data and such, and correcting a erroneous count data piece and such accordingly to restore a proper data piece.